package com.itheima.day04_api;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Scanner;

public class Birthday {
    public static void main(String[] args) throws ParseException {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入自己的生日(按格式2002-3-23)：");
        String birthday = sc.next();
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
        Date parse = simpleDateFormat.parse(birthday);
        long time = parse.getTime();
        Date date = new Date();
        long time1 = date.getTime();
        double days = (time1 - time) / (1000 * 60 * 60 * 24);
        System.out.println("已经活了" + days + "天");


    }
}
